﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
    public class Emp_RewardInfoModel
    {
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        private int _EmpBasicID;
        [DataMember]
        public int EmpBasicID
        {
            get { return _EmpBasicID; }
            set { _EmpBasicID = value; }
        }

        private string _RewardNo = string.Empty;
        [DataMember]
        public string RewardNo
        {
            get { return _RewardNo; }
            set { _RewardNo = value; }
        }

        private string _RewardName = string.Empty;
        [DataMember]
        public string RewardName
        {
            get { return _RewardName; }
            set { _RewardName = value; }
        }

        private string _RewardReason = string.Empty;
        [DataMember]
        public string RewardReason
        {
            get { return _RewardReason; }
            set { _RewardReason = value; }
        }

        private string _OtherRewardReason = string.Empty;
        [DataMember]
        public string OtherRewardReason
        {
            get { return _OtherRewardReason; }
            set { _OtherRewardReason = value; }
        }

        private DateTime? _OKDate = null;
        [DataMember]
        public DateTime? OKDate
        {
            get { return _OKDate; }
            set { _OKDate = value; }
        }

        private string _OKUnit = string.Empty;
        [DataMember]
        public string OKUnit
        {
            get { return _OKUnit; }
            set { _OKUnit = value; }
        }

        private string _EmpName = string.Empty;
        [DataMember]
        public string EmpName
        {
            get { return _EmpName; }
            set { _EmpName = value; }
        }

        private string _EmpNo = string.Empty;
        [DataMember]
        public string EmpNo
        {
            get { return _EmpNo; }
            set { _EmpNo = value; }
        }

        public static Emp_RewardInfoModel FillEntity(DataRow dr)
        {
            Emp_RewardInfoModel right = new Emp_RewardInfoModel();
            right.ID = (int)dr["ID"];
            right.EmpBasicID = (int)dr["EmpBasicID"];
            right.RewardNo = dr["RewardNo"] as string;
            right.RewardName = dr["RewardName"] as string;
            right.RewardReason = dr["RewardReason"] as string;
            right.EmpName = dr["EmpName"] as string;
            right.EmpNo = dr["EmpNo"] as string;
            right.OtherRewardReason = dr["OtherRewardReason"] as string;
            right.OKUnit = dr["OKUnit"] as string;
            right.OKDate = (string.IsNullOrEmpty(dr["OKDate"].ToString()) || dr["OKDate"].ToString() == "1900/1/1 0:00:00") ? null : (DateTime?)dr["OKDate"];
            return right;
        }
    }
}
